<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix='c' uri='http://java.sun.com/jstl/core_rt' %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <title>Login Page</title>
    <script type="text/javascript">
        function echeck(str) {

            var at = "@"
            var dot = "."
            var lat = str.indexOf(at)
            var lstr = str.length
            var ldot = str.indexOf(dot)
            if (str.indexOf(at) == -1) {
                alert("Invalid E-mail ID")
                return false
            }

            if (str.indexOf(at) == -1 || str.indexOf(at) == 0 || str.indexOf(at) == lstr) {
                alert("Invalid E-mail ID")
                return false
            }

            if (str.indexOf(dot) == -1 || str.indexOf(dot) == 0 || str.indexOf(dot) == lstr) {
                alert("Invalid E-mail ID")
                return false
            }

            if (str.indexOf(at, (lat + 1)) != -1) {
                alert("Invalid E-mail ID")
                return false
            }

            if (str.substring(lat - 1, lat) == dot || str.substring(lat + 1, lat + 2) == dot) {
                alert("Invalid E-mail ID")
                return false
            }

            if (str.indexOf(dot, (lat + 2)) == -1) {
                alert("Invalid E-mail ID")
                return false
            }

            if (str.indexOf(" ") != -1) {
                alert("Invalid E-mail ID")
                return false
            }

            return true
        }

        function ValidateForm() {
            var emailID = document.f.j_username

            if ((emailID.value == null) || (emailID.value == "")) {
                alert("Please Enter your Email ID")
                emailID.focus()
                return false
            }
            if (echeck(emailID.value) == false) {
                emailID.value = ""
                emailID.focus()
                return false
            }
            
            return true

        }
    </script>
    <link type="text/css" rel="stylesheet" href="/bob-web/CSS/1.css"/>
    <link type="text/css" rel="stylesheet" href="/bob-web/CSS/2.css"/>
    <link type="text/css" rel="stylesheet" href="/bob-web/CSS/3.css"/>
    <link type="text/css" rel="stylesheet" href="/bob-web/CSS/4.css"/>
    <link type="text/css" rel="stylesheet" href="/bob-web/CSS/5.css"/>
    <link type="text/css" rel="stylesheet" href="/bob-web/CSS/6.css"/>

</head>

<body background="#3B5998">
<div style="width:940px;background:#3B5998">
    <a href="/bob-web/service/homePage.htm"><img border="0" src="/bob-web/Images/logo.png" alt="BookOfBoun" width="180" height="100" /></a>

    <div class="WelcomePage_MainSell">
        <div class="WelcomePage_MainSellCenter clearfix">
            <div class="WelcomePage_SignUpHeadline">Login To Book Of Boun</div>
            <div id="messageDiv"><font color="red"><c:out value="${model.message}"/></font></div>
            <form name="f" action="/bob-web/j_spring_security_check" method="POST" onsubmit="return ValidateForm()">

                <div id="reg_box">
                    <div id="reg_form_box" class="large_box">
                        <br><br><br><br>


                        <table class="uiGrid editor" cellspacing="0" cellpadding="1">
                            <tr>
                                <td class="label">Email:</td>
                                <td>
                                    <div class="field_container">
                                        <input type='text' class='inputtext' id='reg_email__' name='j_username'/>
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td class="label">Password:</td>
                                <td>
                                    <div class="field_container">
                                        <input type='password' class='inputtext' id='reg_passwd__' name='j_password'>
                                    </div>
                                </td>
                            </tr>
                            <tr>
                                <td class="label"></td>
                                <td><label class="uiButton uiButtonSpecial uiButtonMedium">
                                    <input value="Login" name="submit" type="submit">
                                </label>
                                    <label class="uiButton uiButtonSpecial uiButtonMedium">
                                        <input value="Reset" name="reset" type="reset">
                                    </label></td>
                            </tr>
                            <tr>
                                <td class="label"></td>
                                <td><a href="/bob-web/service/register.htm">Register</a></td>
                            </tr>
                            <tr>
                                <td class="label"></td>
                                <td><a href="/bob-web/service/forgotPassword.htm">Forgot Password</a></td>
                            </tr>
                        </table>
                        <p>&nbsp;</p>

                        <p>&nbsp;</p>

                        <p>&nbsp;</p>

                        <p>&nbsp;</p>
                    </div>
                </div>

            </form>
        </div>
    </div>
</div>
</body>
</html>
